/*
 * Copyright 2012 Boulder Food Rescue
 * All rights reserved.
 * 
 * Licensed under the New BSD License. You may not use this file except in 
 * compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.opensource.org/licenses/bsd-license.php
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 * POSSIBILITY OF SUCH DAMAGE.
 */

package org.boulderfoodrescue.webapp.client;

import org.boulderfoodrescue.webapp.client.rpc.LocationService;
import org.boulderfoodrescue.webapp.client.rpc.LocationServiceAsync;
import org.boulderfoodrescue.webapp.client.rpc.LoginService;
import org.boulderfoodrescue.webapp.client.rpc.LoginServiceAsync;
import org.boulderfoodrescue.webapp.client.rpc.PickupService;
import org.boulderfoodrescue.webapp.client.rpc.PickupServiceAsync;
import org.boulderfoodrescue.webapp.client.rpc.TimeSlotService;
import org.boulderfoodrescue.webapp.client.rpc.TimeSlotServiceAsync;
import org.boulderfoodrescue.webapp.client.rpc.UserAccountsService;
import org.boulderfoodrescue.webapp.client.rpc.UserAccountsServiceAsync;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Widget;

/**
 * Entry point for Pickup Scheduler App
 * 
 */
public class BFRWebApp extends Widget implements EntryPoint{

	/**
	 * Executes when the page loads
	 */
	public void onModuleLoad() {
		if(Window.Location.getHost().equals("www.bfrpickup.appspot.com"))
			Window.Location.assign("http://bfrpickup.appspot.com"); 
		LoginServiceAsync loginRPC = GWT.create(LoginService.class);
		UserAccountsServiceAsync userRPC = GWT.create(UserAccountsService.class);
		LocationServiceAsync donorRPC = GWT.create(LocationService.class);
		EventBus eventBus = new SimpleEventBus();
		TimeSlotServiceAsync timeSlotRPC = GWT.create(TimeSlotService.class);
		PickupServiceAsync pickupRPC = GWT.create(PickupService.class);
		@SuppressWarnings("unused")
		AppController appViewer = new AppController(loginRPC, userRPC, donorRPC, timeSlotRPC, pickupRPC, eventBus);
	}
}
